package com.deercrowing.takeaway.controller.user;

import com.deercrowing.takeaway.common.model.Result;
import com.deercrowing.takeaway.service.CategoriesService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@Validated
@RestController
@RequestMapping("user/categories")
public class CategoriesWithUserController {

    @Autowired
    CategoriesService categoriesService;

    /**
     * 获取所有分类
     *
     * @return
     */
    @GetMapping("/list")
    public ResponseEntity selectAll(){
        return ResponseEntity.ok(Result.OK(this.categoriesService.searchAllCategory()));
    }
}
